weiXinController.controller('portalCtl',['$scope','$state','$stateParams','$timeout','$interval','$compile','$rootScope',function($scope,$state,$stateParams,$timeout,$interval,$compile,$rootScope) {
	$scope.weixin_auth = {};
	var wxRetCode = EdeyeAdmin.GetParam('state');

	$scope.jjsprFlag = false;
	$scope.sprFlag = false;

    EdeyeAdmin.post({
        url:'/weixin/loginInfo'
    },{
        SUCCESS:function(ret){
            if(ret.code === '200'){
				$scope.weixin_auth = ret.weixin_auth;
				$scope.auth = ret.auth;

				$scope.jjsprFlag = ret.auth.loginInfo.jjsprFlag;
				$scope.sprFlag = ret.auth.loginInfo.sprFlag;
				
				$scope.$apply();
            }
        }
    });

    $timeout(function () {
        EdeyeAdmin.loginInfo(function (ret) {
        	
        });
    },200);
    
    $scope.goto = function(url){
    	$state.go(url);
    };

    $timeout(function () {
    	var gotoState1 = EdeyeAdmin.GetParam('gotoState');
    	var gotoStateParam2 = EdeyeAdmin.GetParam('gotoStateParam');
    	if(gotoState1 === 'SPR'){
    		$state.go('/spr/order/page',{param:gotoStateParam2});
    	}else if($stateParams.gotoState === 'JJSPR'){
    		$state.go('/jjspr/order/page',{param:gotoStateParam2});
    	}else if($stateParams.gotoState === 'SLR'){
    		$state.go('/slr/order/page',{param:gotoStateParam2});
    	}
    }, 500);
    
}]);